package org.example.system.controller;

import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.example.system.entity.AttendanceEntity;
import org.example.system.service.AttendanceService;
import org.example.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 考勤控制层
 */
@RestController
@RequestMapping("/admin/attendance")
@Slf4j
public class AttendanceController {
    @Autowired
    private AttendanceService attendanceService;

    /**
     * 按条件分页查询
     * @param attendance
     * @return
     */
    @GetMapping("/list")
    public R list(AttendanceEntity attendance) {
        log.info("------------AttendanceController | list | input : {} ", JSON.toJSONString(attendance));
        IPage<AttendanceEntity> page = attendanceService.selectPage(attendance);
        log.info("------------AttendanceController | list | return : {} ", JSON.toJSONString(page));
        return R.ok(page);
    }
}
